$m(function (args) {

    var $this = this.element;
    $('#gray-container').tabs({fit: true});
    //6.44灰度服务监控默认为运行情况，初始化点击调用情况
    $('#gray-container').tabs("option", "active", 0);
    var $layoutDyqk = $this.find("#tempo-dyqk");
    //服务状态表
    var $dyqqServiceTable = $this.find("#dyqk-chart-service-table");
    var $dyqqListTable = $this.find("#dyqk-chart-list-table");
    var $dyqqTimeTable = $this.find("#dyqk-chart-time-table");
    var serviceid = args.id;
    var $dyqk_chart_cricle = $this.find("#dyqk-chart-circle");
    var $dyqk_chart_line = $this.find("#dyqk-chart-line");
    var $layoutYxqk = $this.find("#tempo-yxqk");
    var $yxqkgrid = $layoutYxqk.find("#yxqk-table")
    //同步服务状态
    var serviceStatusList = [];
    var init = function () {

        //dyqk的渲染和绑定事件
        render1.renderLayout();
        render1.renderQuery();
        render1.renderDyqkTable();
        render1.renderDyqqChart();
        render1.renderSelect();//同时渲染dyqq和yxqq的下拉框
        //yxqk的渲染和绑定事件
        renderYxqq.renderLayout();
        renderYxqq.renderQuery();
        renderYxqq.renderGrid();
        var helpInfo_Html = "<i id='icon_help' class=\"el-icon-warning-outline\"></i>";
        if($("#icon_help").length == 0){
            $(helpInfo_Html).appendTo($("#yxqk-table").parent().parent()
                .prev().find("div[id='jqgh_yxqk-table_status']"));
        }
        $(".qtn-style").css("padding", "5px 2px!important");
        $("#gray-monitor-ul").find("li").eq(-1).unbind('click').bind('click', function () {
            var data = {
                client: "",
                starttime: null,
                endtime: null,
                runresult: ""
            }
            $yxqkgrid.datagrid('reloadGrid', data);
        });
    }
    var renderYxqq = {
        renderLayout: function () {
            $layoutYxqk.find("#yxqk-table-container").width($('#gray-container').width() - 40);
            $layoutYxqk.find("#yxqk-table-container1").width($('#gray-container').width() - 40);
        },
        renderQuery: function () {
            var form = $layoutYxqk.find('#queryyxqkForm');
            if ($('#gray-container').width() < 1000) {
                form.find('[name="starttime"]').width('80px');
                form.find('[name="endtime"]').width('80px');
                form.find('[name="result"]').attr('ui-options', 'width: 90');
                form.find('[name=client]').attr('ui-options', 'width: 90');
            } else {
                form.width('1050px');
            }
            TempoUtils.parserUi(form, {});
            form.find('[name="starttime"]').datepicker({
                dateFormat: "yy-mm-dd",
                yearRange: "c-100:",
                //设置日期的最大时间和最小时间
                minDate: DateUtils.formatDate(new Date(new Date().getFullYear() - 100, 0, 1)),
                maxDate: DateUtils.formatDate(new Date(new Date().getFullYear() + 1, 0, 1)),
                changeYear: true,
                changeMonth: true,
                onClose: function (selectedDate) {
                    var d = $(this).datepicker('getDate');
                    if (d == null) {
                        return;
                    }
                    var d2 = new Date(d.getTime());
                    var d2str = d2.Format('yyyy-MM-dd');
                    form.find('[name="endtime"]').datepicker("option", "minDate", d2str);
                },
                onSelect: function (value) {
                },
                onChangeMonthYear: function (year, month, inst) {
                    var month = inst.selectedMonth + 1;
                    var day = inst.selectedDay;
                    var format = function (v) {
                        return String(v).length > 1 ? v : ('0' + v)
                    }
                    $(this).val(inst.selectedYear + '-' + format(month) + '-' + format(inst.selectedDay));
                    $.datepicker._hideDatepicker(this);
                }
            });
            form.find('[name="endtime"]').datepicker({
                dateFormat: "yy-mm-dd",
                yearRange: "c-100:",
                //设置日期的最大时间和最小时间
                minDate: DateUtils.formatDate(new Date(new Date().getFullYear() - 100, 0, 1)),
                maxDate: DateUtils.formatDate(new Date(new Date().getFullYear() + 1, 0, 1)),
                changeYear: true,
                changeMonth: true,
                onSelect: function (value) {
                },
                onClose: function (selectedDate) {
                    var d = $(this).datepicker('getDate');
                    if (d == null) {
                        return;
                    }
                    var d2 = new Date(d.getTime());
                    var d2str = d2.Format('yyyy-MM-dd');
                    form.find('[name="starttime"]').datepicker("option", "maxDate", d2str);
                },
                onChangeMonthYear: function (year, month, inst) {
                    var month = inst.selectedMonth + 1;
                    var day = inst.selectedDay;
                    var format = function (v) {
                        return String(v).length > 1 ? v : ('0' + v)
                    }
                    $(this).val(inst.selectedYear + '-' + format(month) + '-' + format(inst.selectedDay));
                    $.datepicker._hideDatepicker(this);
                }
            });
            form.find('.queryBtn').button({
                click: function () {

                    var client = form.find('[name="client"]').val();
                    var starttime = form.find('[name="starttime"]').datepicker('getDate');
                    var endtime = form.find('[name="endtime"]').datepicker('getDate');
                    var result = form.find('[name="result"]').val();
                    var data = {
                        client: client,
                        starttime: starttime ? DateUtils.formatDate(starttime, 'yyyy-MM-dd') : null,
                        endtime: endtime ? DateUtils.formatDate(endtime, 'yyyy-MM-dd') : null,
                        runresult: result
                    }
                    //重新加载表格
                    $yxqkgrid.datagrid('reloadGrid', data);
                    return false;
                }
            });
            form.find('.resetBtn').button({
                click: function () {
                    form[0].reset();
                    form.find('[name="endtime"]').datepicker("option", "minDate", DateUtils.formatDate(new Date(new Date().getFullYear() - 100, 0, 1)));
                    form.find('[name="starttime"]').datepicker("option", "maxDate", DateUtils.formatDate(new Date(new Date().getFullYear() + 1, 0, 1)));
                    form.find('[name="result"]').val('').selectmenu('refresh');
                    var data = {
                        client: null,
                        starttime: null,
                        endtime: null,
                        runresult: null
                    }
                    //重新加载表格
                    $yxqkgrid.datagrid('reloadGrid', data);
                    return false;
                }
            });
        },
        renderGrid: function () {
            $yxqkgrid.datagrid({
                datatype: "json",
                url: contextPath + '/api/ai/mine/gray/gray-running-log?serviceid=' + serviceid,
                rownumbers: true,
                mtype: 'GET',
                width: $('#gray-container').width() - 40,
                height: $('#gray-container').height() - 190,
                shrinkToFit: true,
                viewrecords: true,
                striped: true,
                pagination: true,
                colNames: ['id',
                    TempoUtils.locale("mine.diaoyongxitong"),
                    TempoUtils.locale("aiview.diaoyongsj"),
                    TempoUtils.locale("aiview.zxhs"),
                    TempoUtils.locale("mine.service_sync_service"),
                    TempoUtils.locale("aiview.dyjg"),
                ],//'操作'
                colModel: [{
                    name: 'id',
                    index: 'id',
                    hidden: true,
                    sortable: false
                }, {
                    name: 'clientName',
                    index: 'clientName',
                    width: 80,
                    sortable: false,
                    formatter: function (obj) {
                        return !!obj ? obj : '无';
                    }
                }, {
                    name: 'runtime',
                    index: 'runtime',
                    width: 80,
                    sortable: false,
                    formatter: function (obj) {
                        return DateUtils.formatDateTime(obj);
                    }
                }, {
                    name: 'pretime',
                    index: 'pretime',
                    sortable: false,
                    width: 120,
                    formatter: function (obj) {

                        var v = obj / 1000;
                        return v.toFixed(2) + "s";
                    }
                }, {
                    sortable: false,
                    width: 120,
                    formatter: function (obj, grid, rows, state) {
                        return rows.appname + "/" + rows.flowname;
                    },
                }, {
                    name: 'status',
                    index: 'status',
                    sortable: false,
                    width: 120,
                    formatter: function (obj, grid, rows, state) {

                        var success = rows.status;
                        if (success == "1") {
                            return TempoUtils.locale("mine.chenggong");
                        }
                        if (success == "0") {
                            return TempoUtils.locale("mine.shibai");
                        }
                        return TempoUtils.locale("mine.zhengzaizhixing");
                    },
                    width: 80
                },
                ]
            });
            setTimeout(function (){
                $("#yxqk-table").parent().parent()
                    .prev().find("div[id='jqgh_yxqk-table_status']").attr("title", "前往原生服务中查看详细日志");
            }, 1000);
        }
    };
    var render1 = {
        renderLayout: function () {

            var lc = $layoutDyqk.find(".layout-center");
            if(lc.length > 0){
                if (args.ht) {
                    lc.height(args.ht - 105);
                } else {
                    lc.height(window.innerHeight - lc.offset().top - 35);
                }
            }
        },
        renderQuery: function () {
            //调用情况的页签渲染
            funList.initQuery();
        },
        renderDyqqChart: function () {
            //渲染调用情况的绘图
            funList.renderDyqqCircleChart();
            funList.evtLoadLineChart("1", true, "");//默认渲染近半年的折线图
        },
        renderDyqkTable: function () {
            //同步服务状态
            $.ajax({
                url: contextPath + '/api/ai/mine/gray/get-sync-status',
                data: {
                    id: serviceid
                },
                type: 'post',
                dataType: 'json',
                success: function (rs) {
                    serviceStatusList = rs.data;
                    //渲染调用情况的表格
                    funList.initServiceStatus();
                }
            });
            funList.initDyqkTable();
        },
        renderSelect: function () {

            //渲染下拉框
            $.ajax({
                url: contextPath + '/api/ai/mine/gray/get-key-by-gray-log',
                data: {
                    id: serviceid
                },
                type: 'get',
                dataType: 'json',
                success: function (rs) {

                    if (rs.success == true) {
                        funList.renderSelect($this.find("#queryForm select[name=client]"), rs.data);
                        funList.renderSelect($layoutYxqk.find("select[name=client]"), rs.data);
                    }
                }
            });
        }
    }

    var funList = {
        evtLoadLineChart: function (dateType, tag, client) {
            var data = {serviceid: serviceid, datetype: dateType, client: client}
            if (!client || client == "") {
                data = {serviceid: serviceid, datetype: dateType}
            }
            $.ajax({
                url: contextPath + '/api/ai/mine/gray/count-by-date-gray?t=' + TempoUtils.uuid(),
                data: data,
                type: 'get',
                dataType: 'json',
                success: function (rs) {

                    if (rs.success == true) {
                        var data = rs.data;
                        var rq = [];
                        var cs = [];
                        var ca = [];
                        data.forEach(function (v, i) {
                            rq.push(v.date1);
                            cs.push(v.sync1times);
                            ca.push(v.sync2times);
                        });
                        var options = funList.lineOptions(rq, cs,ca);
                        funList.renderChart($dyqk_chart_line[0], options);
                        if (tag) {
                            funList.evtChartBar();//给折线图添加绑定事件
                        }
                    }
                }
            });
        },
        evtChartBar: function () {

            var visitToolBar = $("<div class='tempo-achieve-survey-buttonbar-div-class'/>").appendTo($dyqk_chart_line);
            $("<span class='tempo-achieve-survey-buttonbar-span-class '>" + TempoUtils.locale("runtime.lately_week") + "</span>").data("linkType", "4").appendTo(visitToolBar);
            $("<span class='tempo-achieve-survey-buttonbar-span-class'>" + TempoUtils.locale("runtime.lately_month") + "</span>").data("linkType", "3").appendTo(visitToolBar);
            $("<span class='tempo-achieve-survey-buttonbar-span-class'>" + TempoUtils.locale("runtime.lately_three_month") + "</span>").data("linkType", "2").appendTo(visitToolBar);
            $("<span class='tempo-achieve-survey-buttonbar-span-class tempo-achieve-survey-buttonbar-span-select-class'>" + TempoUtils.locale("runtime.lately_half_year") + "</span>").data("linkType", "1").appendTo(visitToolBar);
            visitToolBar.on("click", "span", function () {
                var type = $(this).data("linkType");
                visitToolBar.find('span').removeClass('tempo-achieve-survey-buttonbar-span-select-class');
                $(this).addClass('tempo-achieve-survey-buttonbar-span-select-class');
                var client = $('#tempo-dyqk #queryForm').find('[name="client"]').val();
                funList.evtLoadLineChart(type, null, client);
            });
        },
        renderChart: function (dom, options) {

            if (dom == undefined){
                return;
            }
            var chart = echarts.init(dom);
            chart.setOption(options);
            if (options.series[0].data.length == 0 || options.series[0].data === 0) {
                var dataNull = $("<div class='tempo-mid-data-null'> <span class='data_null_icon applied_data_null'></span> <br/><span class='applied_data_null'>" + TempoUtils.locale("aiview.canvas_data_null") + "</span></div>");
                $(dom).append(dataNull);
            } else {
                $(dom).find(".tempo-mid-data-null").remove();
            }
        },
        initQuery: function () {

            var form = $this.find('#queryForm');
            TempoUtils.parserUi(form, {});
            form.find('[name="starttime"]').datepicker({
                dateFormat: "yy-mm-dd",
                yearRange: "c-100:",
                //设置日期的最大时间和最小时间
                minDate: DateUtils.formatDate(new Date(new Date().getFullYear() - 100, 0, 1)),
                maxDate: DateUtils.formatDate(new Date(new Date().getFullYear() + 1, 0, 1)),
                changeYear: true,
                changeMonth: true,
                onClose: function (selectedDate) {
                    var d = $(this).datepicker('getDate');
                    if (d == null) {
                        return;
                    }
                    var d2 = new Date(d.getTime());
                    var d2str = d2.Format('yyyy-MM-dd');
                    form.find('[name="endtime"]').datepicker("option", "minDate", d2str);
                },
                onSelect: function (value) {
                },
                onChangeMonthYear: function (year, month, inst) {
                    var month = inst.selectedMonth + 1;
                    var day = inst.selectedDay;
                    var format = function (v) {
                        return String(v).length > 1 ? v : ('0' + v)
                    }
                    $(this).val(inst.selectedYear + '-' + format(month) + '-' + format(inst.selectedDay));
                    $.datepicker._hideDatepicker(this);
                }
            });
            form.find('[name="endtime"]').datepicker({
                dateFormat: "yy-mm-dd",
                yearRange: "c-100:",
                //设置日期的最大时间和最小时间
                minDate: DateUtils.formatDate(new Date(new Date().getFullYear() - 100, 0, 1)),
                maxDate: DateUtils.formatDate(new Date(new Date().getFullYear() + 1, 0, 1)),
                changeYear: true,
                changeMonth: true,
                onSelect: function (value) {
                },
                onClose: function (selectedDate) {
                    var d = $(this).datepicker('getDate');
                    if (d == null) {
                        return;
                    }
                    var d2 = new Date(d.getTime());
                    var d2str = d2.Format('yyyy-MM-dd');
                    form.find('[name="starttime"]').datepicker("option", "maxDate", d2str);
                },
                onChangeMonthYear: function (year, month, inst) {
                    var month = inst.selectedMonth + 1;
                    var day = inst.selectedDay;
                    var format = function (v) {
                        return String(v).length > 1 ? v : ('0' + v)
                    }
                    $(this).val(inst.selectedYear + '-' + format(month) + '-' + format(inst.selectedDay));
                    $.datepicker._hideDatepicker(this);
                }
            });
            form.find('.queryBtn').button({
                click: function () {
                    var client = form.find('[name="client"]').val();
                    var starttime = form.find('[name="starttime"]').datepicker('getDate');
                    var endtime = form.find('[name="endtime"]').datepicker('getDate');
                    var data = {
                        client: client,
                        starttime: starttime ? DateUtils.formatDate(starttime, 'yyyy-MM-dd') : null,
                        endtime: endtime ? DateUtils.formatDate(endtime, 'yyyy-MM-dd') : null,
                        serviceid: serviceid
                    }

                    funList.renderDyqqCircleChart(data);//点击查询后渲染柱状图
                    funList.initDyqkTable(data, true);//点击查询后渲染表格
                    funList.evtLoadLineChart("1", true, client);
                    return false;
                }
            });
            form.find('.resetBtn').button({
                click: function () {
                    form[0].reset();
                    form.find('[name="endtime"]').datepicker("option", "minDate", DateUtils.formatDate(new Date(new Date().getFullYear() - 100, 0, 1)));
                    form.find('[name="starttime"]').datepicker("option", "maxDate", DateUtils.formatDate(new Date(new Date().getFullYear() + 1, 0, 1)));
                    form.find('[name="result"]').val('').selectmenu('refresh');
                    return false;
                }
            });

        },
        initServiceStatus: function(){
            var width = $(".tempo-table-status-title-class").width();
            $dyqqServiceTable.datagrid({
                datatype: "local",
                pagination: false,
                height:72,
                data:serviceStatusList,
                width:width,
                fit: false,
                rownumbers:true,
                colNames: [TempoUtils.locale("mine.cognate_service"),TempoUtils.locale("mine.publish-mine-job-grid-col-status")],
                colModel: [{
                    name: 'name',
                    index: 'name',
                    sortable: false,
                }, {
                    name: 'status',
                    index: 'status',
                    sortable: false
                }],
            });
        },
        initDyqkTable: function (queryData, queryTag) {

            var colName_list = ['id', TempoUtils.locale("mine.diaoyongxitong"), TempoUtils.locale("aiview.app_call_times"), TempoUtils.locale("aiview.cgl")];
            var colModel_list = [{name: 'id', sortable: false, hidden: true}, {
                name: 'name',
                sortable: false
            }, {name: 'times', sortable: true},
                {
                    name: 'success', sortable: true, formatter: function (obj) {
                        return (obj * 100).toFixed(2) + "%"
                    }
                }];
            var colName_time = ['id', TempoUtils.locale("mine.diaoyongxitong"), TempoUtils.locale("aiview.xysj")];
            var colModel_time = [{name: 'id', sortable: false, hidden: true}, {name: 'name', sortable: false}, {
                name: 'respontime', sortable: true,
                formatter: function (obj) {
                    return ((obj - 0) / 1000).toFixed(2) + "s";
                }
            }];
            if (queryData == null) {
                queryData = {serviceid: serviceid};
            }
            $.ajax({
                url: contextPath + '/api/ai/mine/gray/top?t=' + TempoUtils.uuid(),
                data: queryData,
                type: 'get',
                dataType: 'json',
                success: function (rs) {
                    if (rs.success == true) {
                        var data = rs.data;
                        if (queryTag) {
                            $dyqqListTable.datagrid("clearGridData");
                            $dyqqTimeTable.datagrid("clearGridData");
                            $dyqqListTable.datagrid("resize");
                            $dyqqTimeTable.datagrid("resize");
                            $dyqqListTable.datagrid("addJSONData", data);
                            $dyqqTimeTable.datagrid("addJSONData", data.slice(0,10));
                            $dyqqListTable.datagrid("resize");
                            $dyqqTimeTable.datagrid("resize");
                        } else {
                            funList.loadTable($dyqqListTable, colName_list, colModel_list, data.sort(function (a, b) {
                                return b.success - a.success
                            }));
                            funList.loadTable($dyqqTimeTable, colName_time, colModel_time, data.sort(function (a, b) {
                                return a.respontime - b.respontime
                            }).slice(0, 10));
                        }
                    }
                }
            });
        },
        loadTable: function (ele, colName, colModel, data) {

            ele.datagrid({
                datatype: "local",
                data: data,
                fit: true,
                rownumbers: true,
                shrinkToFit: true,
                viewrecords: true,
                striped: true,
                colNames: colName,
                colModel: colModel
            });
        },

        barOptions: function(a1,a2){
            return {
                "color": ['#1e8ac5', '#0d9f41'],
                "tooltip": [{
                    "show":true,
                    "showContent":true,
                    "trigger":"item",
                    "triggerOn":"mousemove",
                    "alwaysShowContent":false,
                    "showDelay":0,
                    "hideDelay":100,
                    "enterable":false,
                    "confine":true,
                    "transitionDuration":0.4,
                    "backgroundColor":"#fff",
                    "borderColor":"#ccc",
                    "borderWidth":1,
                    "borderRadius":2,
                    "padding":8,
                    "extraCssText":"box-shadow:1px 1px 3px rgba(0,0,0,0.25);min-height:21px,line-height:21px",
                    "textStyle":{
                        "color":"#444",
                        "fontStyle":"normal",
                        "fontWeight":"normal",
                        "fontFamily":"Microsoft YaHei",
                        "fontSize":12
                    },
                    "title":{
                        "textStyle": {
                            "color":"#000",
                            "fontStyle":"normal",
                            "fontWeight":"normal",
                            "fontFamily":"Microsoft YaHei",
                            "fontSize":12
                        }
                    }
                }],
                "grid": [{
                    "top": 60,
                    "right": 25,
                    "show": true,
                    "left": 30,
                    "borderWidth": 0
                }],
                "title": {
                    "text": TempoUtils.locale("mine.service-suc-fail"), "left": 26,
                    "top": 15,
                    "show": true,
                    "textStyle": {
                        "color": "#333333",
                        "fontSize": 14
                    }
                },
                "legend": {
                    "data": [TempoUtils.locale("mine.publish-mine-job-exe-success"), TempoUtils.locale("mine.publish-mine-job-exe-fail")],
                    "top":280,
                    x:'center',
                    y:'bottom',
                    itemWidth:20,
                    itemHeight:10,
                },
                "toolbox": {
                    "show": false
                },
                "dataZoom":[{"show":false}],
                "xAxis": [
                    {
                        "type": 'category',
                        "axisTick": {"show": false},
                        "data": [TempoUtils.locale("mine.service_sync_service1"), TempoUtils.locale("mine.service_sync_service2")],
                        "axisLine":{"show":false}
                    }
                ],
                "yAxis": [
                    {
                        "type": 'value',
                        "axisTick": {"show": false},
                        "axisLine":{"show":false},
                        "splitArea":{"show":false},
                        "inverse":false
                    }
                ],
                "series": [
                    {
                        "name": TempoUtils.locale("mine.publish-mine-job-exe-fail"),
                        "type": 'bar',
                        // "barGap": 0,
                        "barWidth":60,
                        "data": a1
                    },
                    {
                        "name": TempoUtils.locale("mine.publish-mine-job-exe-success"),
                        "type": 'bar',
                        "barWidth":60,
                        "data": a2
                    }
                ]
            }
        },
        lineOptions: function (rq, cs,ca) {
            return {
                "title": [{
                    "text": TempoUtils.locale("aiview.rdycsbhqs"),
                    "left": 30,
                    "top": 0,
                    "show": true,
                    "textStyle": {
                        "color": "#333333",
                        "fontSize": 14,
                        "fontWeight": "bold"
                    },
                    "padding": [0, 0, 50, 0]
                }
                ],
                "color": ["#1e8ac5","#0d9f41"],
                "grid": [{
                    "top": 60,
                    "right": 25,
                    "show": true,
                    "left": 30,
                    "borderWidth": 0
                }
                ],
                "xAxis": [{
                    "boundaryGap": true,
                    "nameLocation": "middle",
                    "nameGap": 30,
                    "axisLabel": {
                        "interval": "auto",
                        "autoInterval": true
                    },
                    "splitLine": {
                        "show": false
                    },
                    "axisTick": {
                        "show": false
                    },
                    "splitArea": {
                        "show": false,
                    },
                    "axisLine": {
                        "show": false
                    },
                    "nameShow": false,
                    "data": rq,
                }
                ],
                "yAxis": [{
                    "position": "left",
                    "splitArea": {
                        "show": false,
                    },
                    "axisTick": {
                        "show": false
                    },
                    "splitLine": {
                        "show": true
                    },
                    "tempoLabelFmt": {
                        "fillzero": false,
                        "thousandsplitchar": true,
                        "fixnumber": 2,
                        "selfenable": false
                    },
                    "axisLabel": {
                        "show": true,
                    },
                    "axisLine": {
                        "show": false
                    },
                    "nameShow": false
                }
                ],
                "legend": [{
                    "show": true,
                    "top": "bottom",
                    "data": [TempoUtils.locale("mine.service_sync_service1"),TempoUtils.locale("mine.service_sync_service2")]
                }
                ],
                "tooltip": [{
                    "show": true
                }
                ],
                "dataZoom": [{
                    "type": "slider",
                    "show": false
                }
                ],
                "series": [{
                    "type": "line",
                    "yAxisIndex": 0,
                    "barMaxWidth": "100%",
                    "barGap": "30%",
                    "fid": TempoUtils.locale("mine.service_sync_service1"),
                    "name": TempoUtils.locale("mine.service_sync_service1"),
                    "data": cs,
                    "smooth": true
                },{
                    "type": "line",
                    "yAxisIndex": 0,
                    "barMaxWidth": "100%",
                    "barGap": "30%",
                    "fid": TempoUtils.locale("mine.service_sync_service2"),
                    "name": TempoUtils.locale("mine.service_sync_service2"),
                    "data": ca,
                    "smooth": true
                }]

            }
        },
        renderSelect: function (ele, data) {
            ele.empty();
            ele.append($("<option value=''>" + TempoUtils.locale("aiview.all") + "</option>"));
            data.forEach(function (v, i) {
                ele.append($("<option value=" + v.APP_KEY + ">" + v.NAME + "</option>"));
            });
            ele.attr('ui-role', 'selectmenu');
            TempoUtils.parserUi(ele.parent(), {});
        },
        renderDyqqCircleChart: function (queryData) {

            if (queryData == null) {
                queryData = {serviceid: serviceid};
            }
            var arr1 = [];
            var arr2 = [];
            var result1 = {};
            var result2 = {};
            $.ajax({
                url: contextPath + '/api/ai/mine/gray/get-running-gray1?t=' + TempoUtils.uuid(),
                data: queryData,
                type: 'get',
                dataType: 'json',
                async: false,
                success: function (rs) {
                    if (rs.success == true) {
                        result1 = rs.data;
                    }
                }
            });
            $.ajax({
                url: contextPath + '/api/ai/mine/gray/get-running-gray2?t=' + TempoUtils.uuid(),
                data: queryData,
                type: 'get',
                dataType: 'json',
                async: false,
                success: function (rs) {
                    if (rs.success == true) {
                        result2 = rs.data;
                    }
                }
            });

            if((result1.suc != 0 || result1.fai !=0) && (result2.suc != 0 || result2.fai != 0)){
                arr1 = [result1.fai,result2.fai];
                arr2 = [result1.suc,result2.suc];
                var data = funList.barOptions(arr1,arr2);
                funList.renderChart($dyqk_chart_cricle[0], data);
                return;
            }
            if((result1.suc != 0 || result1.fai !=0) && (result2.suc === 0 && result2.fai === 0)){
                arr1 = [result1.fai,0];
                arr2 = [result1.suc,0];
                var data = funList.barOptions(arr1,arr2);
                funList.renderChart($dyqk_chart_cricle[0], data);
                return;
            }
            if((result1.suc === 0 && result1.fai ===0) && (result2.suc != 0 || result2.fai != 0)){
                arr1 = [0,result2.fai];
                arr2 = [0,result2.suc];
                var data = funList.barOptions(arr1,arr2);
                funList.renderChart($dyqk_chart_cricle[0], data);
                return;
            }
            var data = funList.barOptions(0,0);
            funList.renderChart($dyqk_chart_cricle[0], data);
        },
    }
    init();
});